<?php
/******************************************************
v4 - Management Framework
Copyright (C) 2008  Gary Taylor, gMerc Incorporation
http://www.gmerc.com/v4/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

gary@gmerc.com
******************************************************/
class editcompanies {
  function loaddata() {
    global $masterclass;

    $masterclass->loadmodule('companies');

    $masterclass->loadjavascript('',$masterclass->mainconfig['v4rootdir'].'include/suckertreemenu.inc.js');
    
    $masterclass->websiteconfig['title']='Company Information';
    $masterclass->sitevars['companiesid']='1';
    
    $masterclass->site['postfields'][] = array(
      'table'=>'companies',
      'trackingid'=>'companiesid',
      'fields'=>array(
        'name'=>'company_name',
        'address'=>'company_address',
        'city'=>'company_city',
        'state'=>'company_state',
        'zip'=>'company_zip',

        'phone'=>'company_phone',
        'fax'=>'company_fax',
        'mail'=>'company_mail',
        'www'=>'company_www'
      )
    );


  return;
  }
  function savedata() {
    global $masterclass;

    foreach ($masterclass->sitevars['post_action'] as $postaction) {
      switch ($postaction) {
       case 'company_save':
        $masterclass->savedata();
        $masterclass->site['forward']='window.close();';
       break;
      }
    }    
  return;
  }

  function display() {
  global $masterclass;

?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top">
    <td>
<?php
  echo $masterclass->allclasses['websites']->sitebox_pageheader('Company Information','');
?>
  </td>
  </tr>
</table>
<?php
$nav='';
$nav.='<div class="sitebox_navigation" style="width:100%;">';
$nav.='<ul id="sitebox_navmenu">';
$nav.='<li OnClick="jsshowloadingscreen();add_post_action(\'company_save\');frm.submit();"><a>Save</a></li>';
$nav.='<li OnClick="window.close();"><a>Close</a></li>';
$nav.='</ul>';
$nav.='<br style="clear: left;" />';
$nav.='</div>';
echo $nav;
?>
<table width="100%" cellpadding="2" cellspacing="5" border="0">
  <tr valign="top">
  <td width="100%">
<?php
/* Start Window */
?>
<table width="100%" align="center" cellpadding="0" cellspacing="1" class="sitebox_content">
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;"><nobr>Name:&nbsp;</nobr></td>
    <td width="90%"><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_name');?></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">Address:&nbsp;</td>
    <td width="90%"><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_address');?></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">City:&nbsp;</td>
    <td width="90%"><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_city');?></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">State:&nbsp;</td>
    <td width="90%"><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_state','20%');?>&nbsp;&nbsp;&nbsp;Zip:&nbsp;&nbsp;</span><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_zip','55%');?></nobr></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">Phone:&nbsp;</td>
    <td width="90%"><nobr><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_phone');?></nobr></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">Fax:&nbsp;</td>
    <td width="90%"><nobr><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_fax');?></nobr></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">E-Mail:&nbsp;</td>
    <td width="90%"><nobr><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_mail');?></nobr></td>
  </tr>
  <tr valign="bottom">
    <td valign="middle" style="padding-left:2px;text-align:right;">WWW:&nbsp;</td>
    <td width="90%"><nobr><?php echo $masterclass->allclasses['websites']->disp_inputtext('company_www');?></nobr></td>
  </tr>
</table>
<?php
/* End Window */
?>
</td></tr></table>
<?php

  return;
  }
}
?>